package acwing.哈希;

import java.util.HashMap;
import java.util.Map;

/**
 * P0804
 *
 * @author yang
 * @date 2021/12/17
 */
public class P0804 {


    public static void main(String[] args) {
        strcompress("occurrence");
    }

    public static void strcompress(String s) {
        Map<Character, Integer> map = new HashMap<>();

        char[] chars = s.toCharArray();
        for (int i = 0; i < chars.length; i++) {
            map.put(chars[i],map.getOrDefault(chars[i],0) + 1);
            if (map.get(chars[i]) == 1 || map.get(chars[i]) == 3 || map.get(chars[i]) == 6 || map.get(chars[i]) == ' ')
                System.out.print(chars[i]);

        }

    }
}
